package com.j256.ormlite.logger;

import java.lang.reflect.Constructor;

public class LoggerFactory
{
  public static final String LOG_TYPE_SYSTEM_PROPERTY = "com.j256.ormlite.logger.type";
  private static LogType logType;

  private static LogType findLogType()
  {
    String str = System.getProperty("com.j256.ormlite.logger.type");
    LogType localLogType1;
    if (str != null)
      try
      {
        LogType localLogType2 = LogType.valueOf(str);
        localLogType1 = localLogType2;
        return localLogType1;
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
        new LocalLog(LoggerFactory.class.getName()).log(Log.Level.WARNING, "Could not find valid log-type from system property 'com.j256.ormlite.logger.type', value '" + str + "'");
      }
    LogType[] arrayOfLogType = LogType.values();
    int i = arrayOfLogType.length;
    for (int j = 0; ; j++)
    {
      if (j >= i)
        break label102;
      localLogType1 = arrayOfLogType[j];
      if (localLogType1.isAvailable())
        break;
    }
    label102: return LogType.LOCAL;
  }

  public static Logger getLogger(Class<?> paramClass)
  {
    return getLogger(paramClass.getName());
  }

  public static Logger getLogger(String paramString)
  {
    if (logType == null)
      logType = findLogType();
    return new Logger(logType.createLog(paramString));
  }

  public static String getSimpleClassName(String paramString)
  {
    String[] arrayOfString = paramString.split("\\.");
    if (arrayOfString.length <= 1)
      return paramString;
    return arrayOfString[(-1 + arrayOfString.length)];
  }

  public static enum LogType
  {
    private final String detectClassName;
    private final String logClassName;

    static
    {
      // Byte code:
      //   0: new 2	com/j256/ormlite/logger/LoggerFactory$LogType
      //   3: dup
      //   4: ldc 20
      //   6: iconst_0
      //   7: ldc 22
      //   9: ldc 24
      //   11: invokespecial 28	com/j256/ormlite/logger/LoggerFactory$LogType:<init>	(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
      //   14: putstatic 30	com/j256/ormlite/logger/LoggerFactory$LogType:ANDROID	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   17: new 2	com/j256/ormlite/logger/LoggerFactory$LogType
      //   20: dup
      //   21: ldc 31
      //   23: iconst_1
      //   24: ldc 33
      //   26: ldc 35
      //   28: invokespecial 28	com/j256/ormlite/logger/LoggerFactory$LogType:<init>	(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
      //   31: putstatic 37	com/j256/ormlite/logger/LoggerFactory$LogType:SLF4J	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   34: new 2	com/j256/ormlite/logger/LoggerFactory$LogType
      //   37: dup
      //   38: ldc 38
      //   40: iconst_2
      //   41: ldc 40
      //   43: ldc 42
      //   45: invokespecial 28	com/j256/ormlite/logger/LoggerFactory$LogType:<init>	(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
      //   48: putstatic 44	com/j256/ormlite/logger/LoggerFactory$LogType:COMMONS_LOGGING	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   51: new 2	com/j256/ormlite/logger/LoggerFactory$LogType
      //   54: dup
      //   55: ldc 45
      //   57: iconst_3
      //   58: ldc 47
      //   60: ldc 49
      //   62: invokespecial 28	com/j256/ormlite/logger/LoggerFactory$LogType:<init>	(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
      //   65: putstatic 51	com/j256/ormlite/logger/LoggerFactory$LogType:LOG4J2	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   68: new 2	com/j256/ormlite/logger/LoggerFactory$LogType
      //   71: dup
      //   72: ldc 52
      //   74: iconst_4
      //   75: ldc 54
      //   77: ldc 56
      //   79: invokespecial 28	com/j256/ormlite/logger/LoggerFactory$LogType:<init>	(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
      //   82: putstatic 58	com/j256/ormlite/logger/LoggerFactory$LogType:LOG4J	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   85: new 60	com/j256/ormlite/logger/LoggerFactory$LogType$1
      //   88: dup
      //   89: ldc 61
      //   91: iconst_5
      //   92: ldc 63
      //   94: invokevirtual 69	java/lang/Class:getName	()Ljava/lang/String;
      //   97: ldc 63
      //   99: invokevirtual 69	java/lang/Class:getName	()Ljava/lang/String;
      //   102: invokespecial 70	com/j256/ormlite/logger/LoggerFactory$LogType$1:<init>	(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)V
      //   105: putstatic 72	com/j256/ormlite/logger/LoggerFactory$LogType:LOCAL	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   108: bipush 6
      //   110: anewarray 2	com/j256/ormlite/logger/LoggerFactory$LogType
      //   113: astore_0
      //   114: aload_0
      //   115: iconst_0
      //   116: getstatic 30	com/j256/ormlite/logger/LoggerFactory$LogType:ANDROID	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   119: aastore
      //   120: aload_0
      //   121: iconst_1
      //   122: getstatic 37	com/j256/ormlite/logger/LoggerFactory$LogType:SLF4J	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   125: aastore
      //   126: aload_0
      //   127: iconst_2
      //   128: getstatic 44	com/j256/ormlite/logger/LoggerFactory$LogType:COMMONS_LOGGING	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   131: aastore
      //   132: aload_0
      //   133: iconst_3
      //   134: getstatic 51	com/j256/ormlite/logger/LoggerFactory$LogType:LOG4J2	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   137: aastore
      //   138: aload_0
      //   139: iconst_4
      //   140: getstatic 58	com/j256/ormlite/logger/LoggerFactory$LogType:LOG4J	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   143: aastore
      //   144: aload_0
      //   145: iconst_5
      //   146: getstatic 72	com/j256/ormlite/logger/LoggerFactory$LogType:LOCAL	Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   149: aastore
      //   150: aload_0
      //   151: putstatic 74	com/j256/ormlite/logger/LoggerFactory$LogType:$VALUES	[Lcom/j256/ormlite/logger/LoggerFactory$LogType;
      //   154: return
    }

    private LogType(String paramString1, String paramString2)
    {
      this.detectClassName = paramString1;
      this.logClassName = paramString2;
    }

    public Log createLog(String paramString)
    {
      try
      {
        Log localLog = createLogFromClassName(paramString);
        return localLog;
      }
      catch (Exception localException)
      {
        LocalLog localLocalLog = new LocalLog(paramString);
        localLocalLog.log(Log.Level.WARNING, "Unable to call constructor with single String argument for class " + this.logClassName + ", so had to use local log: " + localException.getMessage());
        return localLocalLog;
      }
    }

    Log createLogFromClassName(String paramString)
      throws Exception
    {
      return (Log)Class.forName(this.logClassName).getConstructor(new Class[] { String.class }).newInstance(new Object[] { paramString });
    }

    public boolean isAvailable()
    {
      if (!isAvailableTestClass())
        return false;
      try
      {
        createLogFromClassName(getClass().getName()).isLevelEnabled(Log.Level.INFO);
        return true;
      }
      catch (Exception localException)
      {
      }
      return false;
    }

    boolean isAvailableTestClass()
    {
      try
      {
        Class.forName(this.detectClassName);
        return true;
      }
      catch (Exception localException)
      {
      }
      return false;
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.j256.ormlite.logger.LoggerFactory
 * JD-Core Version:    0.6.2
 */